package com.ja.openchat.viewmodels;

import android.app.Application;

import androidx.annotation.NonNull;

import com.ja.openchat.ui.contact.ContactChooseAdapter;
import com.zy.openchat.core.manager.TgEvent;

import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import me.goldze.mvvmhabit.base.BaseModel;
import me.goldze.mvvmhabit.base.BaseViewModel;


public class ContactChooseViewModel extends BaseViewModel {


    private ContactChooseAdapter contactChooseAdapter;

    public ContactChooseViewModel(@NonNull Application application, BaseModel mRepository) {
        super(application);
    }



    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onTgEvent(final TgEvent tg_event) {
        switch (tg_event.event) {
            case EUser_Td_UpdateContactInfo:
            case EUser_Td_Contact_Photo_Ok: {
                contactChooseAdapter.notifyDataSetChanged();
            }
            break;
        }
    }

    public void setAdapter(ContactChooseAdapter contactChooseAdapter) {
        this.contactChooseAdapter = contactChooseAdapter;
    }
}
